package com.chenl.provider.DEMOS.Spring.配置白名单;

import com.alibaba.fastjson.JSONObject;
import com.chenl.provider.util.CheckWhiteUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;
import java.util.Set;

@RestController
@RequestMapping("/white")
public class WhiteController {
//    @Value("#{${my.map}}")
//    private Map<String, String> map;

    @Value("${my.set:陈,主}")
    private Set<String> set;

    @Value("${my.list:1232,666}")
    private List<String> list;

    @Autowired
    CheckWhiteUtils checkWhiteUtils;

    @GetMapping("/test")

    public String test(){
//        System.out.println(JSONObject.toJSONString(map));
//        System.out.println(JSONObject.toJSONString(set));
//        System.out.println(JSONObject.toJSONString(list));
//        if (list.contains(String.valueOf(12321L))){
//            System.out.println(123);
//        }else {
//            System.out.println(456);
//        }
//        return "ok";
        Boolean check = checkWhiteUtils.check("321");
        System.out.println(check);
        return "ok";
    }
}
